"""
@title(TenX腾晓2024年11月考核答题文件)
@warning(请勿修改参数和返回值)
@warning(请认真填写__init__中的数据)
@author(1323230180)
"""
from typing import List, Tuple


class TenXClass:
    def __init__(self):
        self.name = "江嘉瑜"
        self.id = "3124002009"

    @staticmethod
    def question1(n: int) -> list[str]:
        list_num1=[]
        #取所有范围内的数
        for x in range(1,n+1):
            num=''
        #取的数除4 得到的商和余数，余数是四进制最右一位，以此类推推直到商为0，循环得到每一位，用字符串拼接
            while x>0:
                num=str(x%4)+num
                x//=4
            list_num1.append(num)
        print(list_num1)
        print(n)  # 打印，防止IDE警告
        return list_num1

    @staticmethod
    def question2() -> list[tuple[int, int, int]]:
        list_num2 = []
        #枚举 x y z 为购买三种武器的对应次数
        for x in range(0, 20):
            for y in range(0, 33):
                for z in range(0, 100):
        #同时满足两种条件
                    if 5 * x + 3 * y + z == 100 and x + y + 3 * z == 100:
                        z=z*3
                        tuple_num = (x, y, z)
                        list_num2.append(tuple_num)
        print(list_num2)
        return (list_num2)
    @staticmethod
    def question3(equipment: list[str], prop: list[str], material: list[str], items: list[str]) -> dict[str, list[str]]:
        print(equipment, prop, material, items)  # 打印，防止IDE警告
        list_equipment = []
        list_prop = []
        list_material = []
        for x in items:
            if x in equipment:
                list_equipment.append(x)
            elif x in prop:
                list_prop.append(x)
            elif x in material:
                list_material.append(x)
            else:
                continue
        items_dict = {'equipment': list_equipment, 'prop': list_prop, 'material': list_material}
        print(items_dict)
        return items_dict

    @staticmethod
    def question4(item_values: dict[str, int], items: list[str]) -> tuple[list[str], int]:
        print(item_values, items)  # 打印，防止IDE警告
        items_value = []
        maxvalue_itemslist = []
        for item in items:
            items_value.append(item_values[item])
        a = 0
        count = 0
        while a < 3:
            max_items_value = max(items_value)
            for key in item_values.keys():
                if item_values[key] == max_items_value:
                    maxvalue_itemslist.append(key)
                else:
                    continue
            items_value.remove(max_items_value)
            a += 1
            count = count + max_items_value
        outcome_tuple=(maxvalue_itemslist,count)
        print(outcome_tuple)
        return outcome_tuple

    @staticmethod
    def question5(matrix: list[list[int]]) -> list[tuple[int, int]]:
        coordinatelist = []
        for r in matrix:
            for index in range(len(r)):
                if r[index] == 0:
                    y_coordinate = index + 1
                    x_coordinate = matrix.index(r) + 1
                    coordinate = (x_coordinate, y_coordinate)
                    coordinatelist.append(coordinate)
                else:
                    continue
        print(coordinatelist)
        print(matrix)  # 打印，防止IDE警告
        return coordinatelist
TenXClass().id='3124002009'
TenXClass().name='Yu'



